package com.hyperplan.neptune.parser;

import com.hyperplan.neptune.lexer.Token;

public class ParserException extends Exception {

	private static final long serialVersionUID = -3327910008052596587L;
	
	private Token token;
	
	public ParserException(String pattern, Token token) {
		super(String.format("Cannot parse pattern [%s] because of token [%s]",
				pattern, token.getLocation()));
		this.token = token;
	}
	
	public ParserException(String pattern) {
		super(String.format("Cannot parse pattern [%s] because we reached EOF"));
		token = null;
	}
	
	public Token getToken() {
		return token;
	}
}
